<meta title="" args="advSpace" width="600"/>
<style>
    .PAGE_PARAMS_TIP {
        display: none;
    }
</style>
<form s="valid,form,nda,datac"
      s-data="advSpace"
      id="form" class="form-horizontal p">
    <table class="table table-bordered table-striped table-condensed">
        <tr>
            <td>广告位名称</td>
            <td>
                <input autocomplete="off" type="text" name="name" s-valid-error="require()" class="form-control input-sm" placeholder="请输入广告位名称">
            </td>
        </tr>
        <tr>
            <td>广告位编码</td>
            <td>
                <select class="form-control" s="select"
                        name="code"
                        s-build="S.get('/api/enum/valuesMap/core.enums.AdvSpaceCode')">
                </select>
            </td>
        </tr>
        <tr>
            <td>状态</td>
            <td>
                <select name="valid" class="form-control">
                    <option value="true">正常</option>
                    <option value="false">锁定</option>
                </select>
            </td>
        </tr>
    </table>
</form>
<script>
    S.meta.title = advSpace ? '编辑' : '新建'
    advSpace = advSpace || {}
    S.meta.btns = [
        {
            name: "确定",
            style: "btn btn-primary",
            click: function() {
                $form.validate().done(function() {
                    var obj = Smart.serializeToObject($form.node);
                    if(advSpace.id) {
                        S.put("/api/adv-space/" + advSpace.id, obj).done(function() {
                            S.close(true)
                        })
                    } else {
                        S.post("/api/adv-space", obj).done(function() {
                            S.close(true)
                        })
                    }
                })
            }
        },
        {
            name: "关闭",
            style: "btn btn-default",
            click: function() {
                S.close();
            }
        }
    ]

</script>